/*
 * @Author: Eureka 
 * @Date: 2020-09-03 17:32:49 
 * @Last Modified by: Eureka
 * @Last Modified time: 2022-10-24 13:51:21
 */
/*
 * 全局字体对齐方式
 */
import 'package:flutter/material.dart';

TextAlign textAlignCenter = TextAlign.center;
TextAlign textAlignLeft = TextAlign.left;
TextAlign textAlignRight = TextAlign.right;
TextAlign textAlignJustify = TextAlign.justify;
TextAlign textAlignStart = TextAlign.start;
TextAlign textAlignEnd = TextAlign.end;

/*
 * 全局字体粗细
 */
FontWeight fontW200 = FontWeight.w200; //Extra Light (Ultra Light)
FontWeight fontW300 = FontWeight.w300; //Light
FontWeight fontW400 = FontWeight.w400; //Regular(Normal、Book、Roman)
FontWeight fontW500 = FontWeight.w500; //Medium
FontWeight fontW600 = FontWeight.w600; // Semi Bold (Demi Bold)
FontWeight fontW800 = FontWeight.w800; // Extra Bold (Ultra Bold)

FontWeight light = FontWeight.w300; //Light
FontWeight regular = FontWeight.w400; //regular normal
FontWeight medium = FontWeight.w500; //Medium
FontWeight semibold = FontWeight.w600; //semibold
FontWeight bold = FontWeight.w700; //bold
FontWeight extrabold = FontWeight.w800; //Extra-bold
FontWeight black = FontWeight.w900; //black

Text text(
        {required String textString,
        Color? textColor,
        FontWeight textWeight = FontWeight.w400,
        double? textSize,
        TextAlign textAligin = TextAlign.left,
        Color? darktextColor,
        String? textFamily,
        double? height,
        TextDecoration decoration = TextDecoration.none}) =>
    Text(textString,
        textScaleFactor: 1,
        style: TextStyle(
            fontFamily: textFamily,
            height: height,
            color: textColor,
            fontWeight: textWeight,
            fontSize: textSize,
            decoration: decoration),
        textAlign: textAligin,
        overflow: TextOverflow.ellipsis);

Text textRich(
        {required String textString,
        Color? textColor,
        FontWeight textWeight = FontWeight.w400,
        double? textSize,
        TextAlign textAligin = TextAlign.left,
        Color? darktextColor,
        int maxLine = 1,
        double? height,
        Widget? widgetSpan,
        Widget? leftSpan,
        String? textFamily,
        TextOverflow overflow = TextOverflow.clip,
        TextDecoration decoration = TextDecoration.none}) =>
    Text.rich(
      TextSpan(
        children: [
          WidgetSpan(child: leftSpan ?? Container()),
          TextSpan(
            text: textString,
            style: TextStyle(
                fontFamily: textFamily,
                height: height,
                color: textColor,
                fontWeight: textWeight,
                fontSize: textSize,
                decoration: decoration),
          ),
          WidgetSpan(child: widgetSpan ?? Container())
        ],
      ),
      textAlign: textAligin,
      overflow: overflow,
      maxLines: maxLine,
    );

Text textSpanRich(
        {TextAlign textAligin = TextAlign.left,
        int maxLine = 1,
        double? height,
        Widget? widgetSpan,
        List<InlineSpan>? children,
        TextOverflow overflow = TextOverflow.ellipsis,
        TextDecoration decoration = TextDecoration.none}) =>
    Text.rich(
      TextSpan(
        children: children,
      ),
      textAlign: textAligin,
      overflow: overflow,
      maxLines: maxLine,
    );

TextSpan textSpan(
        {required String textString,
        Color? textColor,
        FontWeight textWeight = FontWeight.w400,
        double? textSize,
        String? textFamily,
        double? height,
        TextDecoration decoration = TextDecoration.none}) =>
    TextSpan(
      text: textString,
      style: TextStyle(
          fontFamily: textFamily,
          height: height,
          color: textColor,
          fontWeight: textWeight,
          fontSize: textSize,
          decoration: decoration),
    );
